home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 43 / Amiga Format CD43 (1999)(Future Publishing)(GB)(Track 1 of 2)[!][issue 1999-09].iso / -serious- / misc / gethelp / source / report.c < prev   
C/C++ Source or Header  |  1999-06-14  |  2KB  |  80 lines

  1. #include <stdio.h>
  2.  
  3. void start_report(fp, target, case_flag, whole_flag, nfiles)
  4.  
  5. FILE *fp;
  6. char *target;
  7. int case_flag;
  8. int whole_flag;
  9. int nfiles;
  10.  
  11. {
  12.     fprintf(fp,"<HTML>\n");
  13.     fprintf(fp,"\t<HEAD>\n");
  14.     fprintf(fp,"\t\t<TITLE>\n");
  15.     fprintf(fp,"Search results for '%s'\n",target);
  16.     fprintf(fp,"\t\t</TITLE>\n");
  17.     fprintf(fp,"\t</HEAD>\n");
  18.     fprintf(fp,"\t<BODY bgcolor=white>\n");
  19.     fprintf(fp,"<H1 ALIGN=CENTER>\n");
  20.     fprintf(fp,"<BR>\n");
  21.     fprintf(fp,"<B>Search Report</B>");
  22.     fprintf(fp,"</H1>\n");
  23.     fprintf(fp,"<BR>\n");
  24.     fprintf(fp,"Search for word or phrase '<B><FONT COLOR=darkblue>%s</FONT></B>'<BR><BR>\n",target);
  25.  
  26.     if (case_flag)
  27.         fprintf(fp,"Attempting to make a case-sensitive match...<BR>\n");
  28.     else
  29.         fprintf(fp,"Ignoring upper/lower case...<BR>\n");
  30.  
  31.     if (!whole_flag)
  32.         fprintf(fp,"Accepting partial word matches...<BR>\n");
  33.     else
  34.         fprintf(fp,"Matching whole words only...<BR>\n");
  35.  
  36.     fprintf(fp,"<HR>\n");
  37.     fprintf(fp,"<H4><B>Search Results</B></H4>\n");
  38.     fprintf(fp,"<BR>\n");
  39.  
  40.     fprintf(fp,"Number of files examined: %d<BR>", nfiles);
  41.  
  42. }
  43.  
  44. void add_url(fp, file_name, title)
  45.  
  46. FILE *fp;
  47. char *file_name;
  48. char *title;
  49. {
  50.     fprintf(fp,"<UL><LI><A HREF=%s>%s</A></UL>\n", file_name, title);
  51. }
  52.  
  53. void finish_report(fp, nfound)
  54.  
  55. FILE *fp;
  56. int nfound;    /* number of target files found */
  57. {
  58.     /* display error line if none found */
  59.     switch (nfound) {
  60.         case 0:
  61.             fprintf(fp,"<BR>\n");
  62.             fprintf(fp,"<F0NT C0L0R=red><B>No files found containing this text...</B>\n");
  63.             break;
  64.  
  65.         case 1:
  66.             fprintf(fp,"<FONT COLOR=darkgreen><B>One file matches your search.</B>\n");
  67.             break;
  68.  
  69.         default:
  70.             fprintf(fp,"<FONT COLOR=darkgreen><B>%d files match your search.</B>\n",nfound);
  71.             break;
  72.         }
  73.     fprintf(fp,"<BR><HR>\n");
  74.     fprintf(fp,"\t</BODY>\n");
  75.     fprintf(fp,"</HTML>\n");
  76.  
  77. }
  78.  
  79.  
  80.